﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE GetWorkflowTrigger
@WorkflowID int	
AS
BEGIN
DECLARE @ProcessVersionID int
SET @ProcessVersionID = (
	 select top 1  ProcessVersionID FROM ProcessVersions 
	 where WorkflowID =@WorkflowID
	 and CURRENT_TIMESTAMP >= EffectiveDate
	 order by EffectiveDate desc)

SELECT * FROM Steps 
where ProcessVersionID = @ProcessVersionID
AND Type = 'start'

END
